package com.pactera.miyuangroup.vo.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ApiModel(description = "分页request")
public class PageRequest extends BaseRequest {

    /**
     * 当前页码
     */
    @ApiModelProperty(value = "（可选）当前页码,默认第一页")
    private Integer current;
    /**
     * 每页条数
     */
    @ApiModelProperty(value = "（可选）每页条数，默认10条，最大不能超过200条")
    private Integer size;


    public Integer getCurrent() {
        if (null == current || current.intValue() <= 0) {
            return current = 1;
        }
        return current;
    }

    public void setCurrent(Integer current) {
        if (null == current || current.intValue() <= 0) {
            this.current = 1;
            return;
        }
        this.current = current;
    }

    public Integer getSize() {
        if (null == size || size.intValue() <= 0 || size.intValue() > 200) {
            return size = 10;
        }
        return size;
    }

    public void setSize(Integer size) {
        if (null == size || size.intValue() <= 0 || size.intValue() > 200) {
            this.size = 10;
            return;
        }
        this.size = size;
    }
}
